<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Category;

class CategorySeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        {
            $nestArrA = [
                'name' => '资讯',
                'children' => [
                    ['name' => '综合'],
                    ['name' => '新闻'],
                    ['name' => '时政'],
                    ['name' => '国际'],
                    ['name' => '军事'],
                    ['name' => '财经'],
                    ['name' => '历史']
                ],
            ];
            $nestArrB = [
                'name' => '生活',
                'children' => [
                    ['name' => '情感'],
                    ['name' => '房产'],
                    ['name' => '健康'],
                    ['name' => '美食'],
                    ['name' => '家居'],
                    ['name' => '旅游'],
                    ['name' => '汽车'],
                    ['name' => '购物']
                ],
            ];
            $nestArrC = [
                'name' => '教育',
                'children' => [
                    ['name' => '育儿'],
                    ['name' => '基教'],
                    ['name' => '高教'],
                    ['name' => '职教'],
                    ['name' => '终身学习'],
                    ['name' => '科研'],
                    ['name' => '图书'],
                    ['name' => '外语'],
                    ['name' => '知识'],
                ],
            ];
            $nestArrD = [
                'name' => '科技',
                'children' => [
                    ['name' => '网络'],
                    ['name' => '数码'],
                    ['name' => '软件'],
                    ['name' => '手机'],
                    ['name' => '电脑'],
                    ['name' => '智能'],
                    ['name' => '科学'],
                    ['name' => '探索']
                ],
            ];
            $nestArrE = [
                'name' => '文体',
                'children' => [
                    ['name' => '文化'],
                    ['name' => '艺术'],
                    ['name' => '体育'],
                    ['name' => '国学'],
                    ['name' => '美术']
                ],
            ];
            $nestArrF = [
                'name' => '娱乐',
                'children' => [
                    ['name' => '影视'],
                    ['name' => '音乐'],
                    ['name' => '综艺'],
                    ['name' => '游戏'],
                    ['name' => '时尚']
                ],
            ];
            
            Category::create($nestArrA); // 将数组构建为树
            Category::create($nestArrB);
            Category::create($nestArrC);
            Category::create($nestArrD);
            Category::create($nestArrE);
            Category::create($nestArrF);
            }
    }
}
